<template>
  <div class="payment-success">
    <el-card class="success-card">
      <div class="success-icon">
        <i class="el-icon-check"></i>
      </div>
      <h1 class="success-title">支付成功</h1>
      <p class="success-amount">支付金额: ¥{{ amount }}</p>
      <el-button type="primary" @click="goBack" class="back-button">
        返回
      </el-button>
    </el-card>
  </div>
</template>

<script>
export default {
  name: 'PaymentSuccess',
  data() {
    return {
      amount: sessionStorage.getItem("totalPrice"),
    }
  },
  methods: {
    goBack() {
      // 这里可以根据需要修改返回逻辑
      const token = sessionStorage.getItem("authentication");
      this.$router.push({
        path: '/orders',
        query: { token: token }
      });
    }
  }
}
</script>

<style scoped>
.payment-success {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  background-color: #fffbf0;
}

.success-card {
  width: 90%;
  max-width: 400px;
  text-align: center;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.success-icon {
  font-size: 80px;
  color: #ffc300;
  margin-bottom: 20px;
}

.success-title {
  font-size: 24px;
  color: #303133;
  margin-bottom: 10px;
}

.success-amount {
  font-size: 18px;
  color: #606266;
  margin-bottom: 30px;
}

.back-button {
  background-color: #ffc300;
  border-color: #ffc300;
  font-size: 16px;
  padding: 12px 24px;
  transition: all 0.3s ease;
}

.back-button:hover,
.back-button:focus {
  background-color: #e6b000;
  border-color: #e6b000;
}

/* 添加一些动画效果 */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

.success-card {
  animation: fadeIn 0.5s ease-out;
}
</style>
